package demo1224.pm;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/*
把读到数据存放到字节数组中,写出
 */
public class Demo_06 {
    public static void main(String[] args) {
        try (FileInputStream fd = new FileInputStream("lyf.jpg");
             FileOutputStream fw=new FileOutputStream("bc.jpg")) {
            int read;
            byte[] as=new byte[1024];
            while ((read=fd.read(as))!=-1){
                fw.write(as,0,read);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
